//
//  CXGCDTimer.h
//  JwPackDemo
//
//  Created by 陈警卫 on 2025/8/15.
//

#import <Foundation/Foundation.h>

@interface CXGCDTimer : NSObject

/// 初始化计时器
/// 默认 global队列 100ms容差
+ (CXGCDTimer *)startWithInterval:(NSTimeInterval)interval handler:(dispatch_block_t)handler;

/// 初始化计时器
/// queue 计时器队列
/// leeway 容差值(单位s)
+ (CXGCDTimer *)startWithInterval:(NSTimeInterval)interval
                            queue:(dispatch_queue_t)queue
                           leeway:(CGFloat)leeway
                          handler:(dispatch_block_t)handler;

/// 初始化计时器
/// 默认 global队列 100ms容差
- (void)startWithInterval:(NSTimeInterval)interval handler:(dispatch_block_t)handler;

/// 初始化计时器
/// queue 计时器队列
/// leeway 容差值(单位s)
- (void)startWithInterval:(NSTimeInterval)interval queue:(dispatch_queue_t)queue leeway:(CGFloat)leeway handler:(dispatch_block_t)handler;

/// 暂停计时器
- (void)pause;

/// 恢复计时器
- (void)resume;

/// 停止销毁计时器
- (void)stop;

@end
